package cn.itcast.javaee.springmvc.app11;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.validation.BindException;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 作者  Administrator
 * 时间  2017/5/2 15:16
 * 文件  SpringMVC64
 * 描述  处理表单 传入一个表单对象
 */
public class VefiyAction extends AbstractCommandController {

	@Override
	protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
//		binder.registerCustomEditor(Date.class,new CustomDateEditor());
	}

	@Override
	protected ModelAndView handle(HttpServletRequest httpServletRequest,
	                              HttpServletResponse httpServletResponse,
	                              Object o, BindException e) throws Exception {
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("user",o.hashCode());
		return modelAndView;
	}
}
